package com.zhaorl.domain.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

/**
 * @Description 自定义响应格式
 * @Author zhaorl
 * @Date 2023/3/28 14:37
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL) // 为null的字段不序列化
public class ResponseResult<T> {

    // 响应码
    private Integer code;

    // 响应提示语
    private String msg;

    // 响应数据体
    private T data;

    public ResponseResult(Integer code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public ResponseResult(Integer code,T data){
        this.code = code;
        this.data = data;
    }

    public ResponseResult(Integer code,String msg,T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }


}
